# Contributor: Alisa <corg@disroot.org>
# Contributor: Maxim Karasev <begs@disroot.org>
# Maintainer: Alisa <corg@disroot.org>
pkgname=gamescope
pkgver=3.12.0
pkgrel=1
_openvr=1a0ea26642e517824b66871e6a12280a426cfec3
_vkroots=26757103dde8133bab432d172b8841df6bb48155
pkgdesc="SteamOS session compositing window manager"
url="https://github.com/Plagman/gamescope"
arch="all"
license="BSD-2-Clause"
makedepends="
	benchmark-dev
	cmake
	glm-dev
	glslang-dev
	hwdata-dev
	libcap-dev
	libdisplay-info-dev
	libliftoff-dev
	libx11-dev
	libxcomposite-dev
	libxmu-dev
	libxrender-dev
	libxres-dev
	libxtst-dev
	libxxf86vm-dev
	meson
	pipewire-dev
	sdl2-dev
	stb
	vulkan-loader-dev
	wayland-protocols
	wlroots0.16-dev
	xwayland-dev
	"
source="https://github.com/Plagman/gamescope/archive/refs/tags/$pkgver/gamescope-$pkgver.tar.gz
	openvr-$_openvr.tar.gz::https://github.com/ValveSoftware/openvr/archive/$_openvr.tar.gz
	vkroots-$_vkroots.tar.gz::https://github.com/Joshua-Ashton/vkroots/archive/$_vkroots.tar.gz
	gcc13.patch
	null.patch
	system-wlroots-libliftoff.patch
	"
options="!check" # no tests

prepare() {
	default_prepare

	rmdir subprojects/vkroots
	ln -sfv "$srcdir"/vkroots-$_vkroots subprojects/vkroots
	rmdir subprojects/openvr
	ln -sfv "$srcdir"/openvr-$_openvr subprojects/openvr
}

build() {
	CXXFLAGS="$CXXFLAGS -DRTLD_DEEPBIND=0" \
	abuild-meson \
		-Db_lto=true \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install \
		--no-rebuild \
		--skip-subprojects \
		-C output
}

sha512sums="
864d61d9caf0bb8b13c71a084dd54a74e4d9104168cdc9ff8bc971e5a78a019fa80bf43c3b58b2e5ade6d461842385c37c3184ceede7e058d4d8d989a9e62bd9  gamescope-3.12.0.tar.gz
17ce420ed384e16abadddfae4912beba861d34a258c1dee7f39ccd3a83e6e44cca504fb5e994962fc06d97e220ca9a22d952f5e47ac18ba58e8f2c3341c0cf40  openvr-1a0ea26642e517824b66871e6a12280a426cfec3.tar.gz
606395000264647f0e74aeb4699b63e29de367b5c97b8d26c01b9373cc130ae0cf872ffaa56b826ed6e0b4170654df1af8f4272f8ed6f83fcc6f75750e8d3c2a  vkroots-26757103dde8133bab432d172b8841df6bb48155.tar.gz
83ba06fbf89d84d1e56a69c5feb474ab3d1f2b2ccf686d5bdd4c408065b7aaaf0a847979e8e5e8d815d02b5fc88ce4592f88af7f2b2eaf9668b9cdad0070f17d  gcc13.patch
e32763bec60c9b8927882f5b1866c684bc8f6d220c6c9cad5fdfc6926bcf97bd02d2d105c3d91ff56baf4680e65a8460894e09bb58d859ee8c98c19973f4c684  null.patch
9fea6675d8c29d740c77d9ce6b69da4a1f54f39bf7a372fe538f154bb97f5cc21436033eeab1f2a154c5aee04410e5194b779c33104ab78b1a8a84ca5d798be2  system-wlroots-libliftoff.patch
"
